// UnicodeIni.h: interface for the CUnicodeIni class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_UNICODEINI_H__C2EBE680_B06B_49FA_BDD1_9F3B74B6D19A__INCLUDED_)
#define AFX_UNICODEINI_H__C2EBE680_B06B_49FA_BDD1_9F3B74B6D19A__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <wtypes.h>
#include <string>
using namespace std;

class CUnicodeIni  
{
public:
	CUnicodeIni();
	virtual ~CUnicodeIni();
public:
	
	static INT GetPrivateProfileInt(
		LPCWSTR lpAppName,  // address of section name
		LPCWSTR lpKeyName,  // address of key name
		INT nDefault,       // return value if key name is not found
		LPCWSTR lpFileName  // address of initialization filename
		);

	static DWORD GetPrivateProfileSection(
		LPCWSTR lpAppName,        // address of section name
		LPWSTR lpReturnedString,  // address of return buffer
		DWORD nSize,              // size of return buffer
		LPCWSTR lpFileName        // address of initialization filename
		);

	static DWORD GetPrivateProfileSectionNames(
		LPWSTR lpszReturnBuffer,  // address of return buffer
		DWORD nSize,              // size of return buffer
		LPCWSTR lpFileName        // address of initialization filename
		);

	static DWORD GetPrivateProfileString(
		LPCWSTR lpAppName,        // points to section name
		LPCWSTR lpKeyName,        // points to key name
		LPCWSTR lpDefault,        // points to default string
		LPWSTR lpReturnedString,  // points to destination buffer
		DWORD nSize,              // size of destination buffer
		LPCWSTR lpFileName        // points to initialization filename
		);

	static BOOL WritePrivateProfileSection(
		LPCWSTR lpAppName,  // pointer to string with section name
		LPCWSTR lpString,   // pointer to string with data
		LPCWSTR lpFileName  // pointer to string with filename
		);

	static BOOL WritePrivateProfileString(
		LPCWSTR lpAppName,  // pointer to section name
		LPCWSTR lpKeyName,  // pointer to key name
		LPCWSTR lpString,   // pointer to string to add
		LPCWSTR lpFileName  // pointer to initialization filename
		);

	static BOOL WritePrivateProfileInt(
		LPCWSTR lpAppName,  // pointer to section name
		LPCWSTR lpKeyName,  // pointer to key name
		INT nValue,   // pointer to string to add
		LPCWSTR lpFileName  // pointer to initialization filename
		);

private:
	static DWORD GetSections(LPCWSTR lpStr, LPWSTR lpReturn);
	static DWORD GetKeys(LPCWSTR lpSTR, LPCWSTR lpSection, LPWSTR lpReturn);
	static DWORD GetValue(LPCWSTR lpSTR, LPCWSTR lpSection, LPCWSTR lpKey, LPWSTR lpReturn);
	static inline LPWSTR trim(LPWSTR str);
	static inline LPWSTR rtrim(LPWSTR str);
	static inline LPWSTR ltrim(LPWSTR str);
	static void DeleteSection(wstring &filecontent, LPCWSTR lpSection);
	static void WriteSection(wstring &filecontent, LPCWSTR lpSection, LPCWSTR lpStr);
	static void DeleteKey(wstring &filecontent, LPCWSTR lpSection, LPCWSTR lpKey);
	static void WriteKey(wstring &filecontent, LPCWSTR lpSection, LPCWSTR lpKey, LPCWSTR lpStr);

	
};

#endif // !defined(AFX_UNICODEINI_H__C2EBE680_B06B_49FA_BDD1_9F3B74B6D19A__INCLUDED_)
